Skip to content

feat: Wave 2 — HashMap determinism, safety-case GSN, ISLE rule verification (#50)#77

Merged
avrabe merged 1 commit intomainfrom
feat/wave2-determinism-safety-case-isle-verification
Apr 13, 2026
Merged

feat: Wave 2 — HashMap determinism, safety-case GSN, ISLE rule verification (#50)#77
avrabe merged 1 commit intomainfrom
feat/wave2-determinism-safety-case-isle-verification

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Apr 13, 2026

Summary

  • HashMap determinism (REQ-14): Replace 5 iteration-order-sensitive HashMaps with BTreeMap in lib.rscoloring, local_info, last_sets/block_sets/loop_sets/then_sets, color_types, old_idx_to_type, global_constants. Ensures identical inputs always produce identical outputs.
  • Safety-case GSN artifacts: 6 safety goals (SG-1 to SG-6) covering all 20 hazards, 2 strategies, 5 solutions (evidence), 1 context. stpa-hazards-have-safety-goals goes from 0% to 100%.
  • ISLE rule verification (ISLE rule verification (Crocus-style) #50): Z3-based verification of 6 constant folding rules (i32/i64 add/sub/mul). Proves correctness for all 2^N inputs via SMT. 8 new tests.

Depends on

Test plan

  • cargo build --release — passes
  • cargo test --release — 395 tests pass, 0 failures (8 new rule verification tests)
  • All pre-commit hooks pass (fmt, clippy, test, build, rivet)
  • rivet list --type safety-goal — 6 goals detected
  • CI checks

🤖 Generated with Claude Code

…cation (#50)

HashMap determinism (REQ-14):
- Replace 5 iteration-order-sensitive HashMaps with BTreeMap in lib.rs:
  coloring, local_info, last_sets/block_sets/loop_sets/then_sets,
  color_types, old_idx_to_type, global_constants
- Ensures identical inputs always produce identical outputs

Safety-case GSN artifacts:
- 6 safety goals (SG-1 to SG-6) covering all 20 hazards
- 2 safety strategies (SS-1, SS-2)
- 5 safety solutions (SOL-1 to SOL-5) as evidence
- 1 safety context (SC-CTXT-1)
- stpa-hazards-have-safety-goals: 0% → 100%

ISLE rule verification groundwork (#50):
- Z3-based verification of constant folding rules
- Proves i32/i64 add/sub/mul rules correct for all 2^N inputs
- 8 new tests: per-rule verification + integration suite

Trace: REQ-14, REQ-6, SG-1, SG-2
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@avrabe avrabe merged commit da1720f into main Apr 13, 2026
22 checks passed
@avrabe avrabe deleted the feat/wave2-determinism-safety-case-isle-verification branch April 13, 2026 18:04
avrabe added a commit that referenced this pull request May 1, 2026
* refactor: extract float NaN/subnormal helpers for auditability (H-1.4, H-1.5)

Extract inline NaN canonicalization and subnormal checks into reusable
helper functions: F32/F64_CANONICAL_NAN constants, is_f32/f64_subnormal(),
canonicalize_f32/f64(). Pure refactor, no behavioral change.

Makes the float constant folding code auditable against hazards H-1.4
(non-canonical NaN) and H-1.5 (subnormal flushing).

Trace: H-1
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>

* docs+chore: align stale artifacts and docs with code

Doc drift fixes:
- README, usage.md, quick-reference.md, architecture.md: drop stale
  phase-count claims (12-/10-/11-phase) — describe pipeline by passes,
  not by number. Numbers go stale; descriptions don't.
- README: Z3 verification is on by default ("default = ['verification',
  'attestation']" in loom-core/Cargo.toml), not opt-in. Document
  --no-default-features as the disable path.
- README: replace broken Bazel WASM build command with the cargo
  invocation CI actually uses.
- architecture.md: inline heuristics now match code (call_count == 1
  || size < 10, cap size < 50) — were wrongly stated as size < 20 &&
  call_count > 2 / size < 5.
- docs/analysis/z3-status.md: integer memory ops are Z3-verified;
  document known model limitations (top-of-stack-only equivalence,
  Br/BrIf/BrTable break-semantics, contains_unverifiable_instructions
  silently auto-passing).

Stale safety artifacts:
- H-17 MITIGATED: stack validation re-enabled at lib.rs:6782 by 84ce9f7.
- H-18 MITIGATED: Wave 2 added Z3-based ISLE rule verification (REQ-6,
  SG-3); verification feature is default-on.
- H-19 MITIGATED: PR #53 (ac01a19) and PR #80 (c1eb8f3) cover prior
  ISLE skip cases; rewrite_pure now applies to BrIf/BrTable functions.
- H-20 MITIGATED: Wave 2 swapped 5 iteration-order-sensitive HashMaps
  to BTreeMap (REQ-14, #77).
- DD-4 / REQ-10 aligned: drop "12-phase" / "10-phase CLI" framing,
  describe the canonical pass list without phase numbering.

Rivet metadata refresh:
- AGENTS.md regenerated via `rivet init --agents --migrate`. Stale
  duplicate "Project Overview" content removed (was claiming 144
  artifacts / 55 errors / 3 UCAs; reality is 207 / 9 errors / 25 UCAs).
- .rivet/agent-context.md regenerated via `rivet context`.

.gitignore: bazel-* artifacts, .claude/worktrees/ — silences git
status noise.

Trace: H-17, H-18, H-19, H-20, REQ-10, DD-4

---------

Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant